﻿using System;
using System.Collections.Generic;

namespace ValidationEngine.Commons.Interfaces
{
    /// <summary>
    /// Validation info interface
    /// </summary>
    public interface IValidationInfo
    {
        /// <summary>
        /// Adds error note
        /// </summary>
        /// <param name="text"></param>
        void AddError(string text);
        /// <summary>
        /// Adds info note
        /// </summary>
        /// <param name="text"></param>
        void AddInfo(string text);
        /// <summary>
        /// Adds warning note
        /// </summary>
        /// <param name="text"></param>
        void AddWarning(string text);
        /// <summary>
        /// Clears all validation notes
        /// </summary>
        void Clear();
        /// <summary>
        /// Clears only errors notes
        /// </summary>
        void ClearErrors();
        /// <summary>
        /// Clears only info notes
        /// </summary>
        void ClearInfos();
        /// <summary>
        /// Clears only warning notes
        /// </summary>
        void ClearWarnings();
        /// <summary>
        /// Returns agregated error string
        /// </summary>
        string ErrorText { get; }
        /// <summary>
        /// Returns agregated warning strnig
        /// </summary>
        string WarningText { get; }
        /// <summary>
        /// Returns agregated info string
        /// </summary>
        string InfoText { get; }
        /// <summary>
        /// True if only info present
        /// </summary>
        bool HasInfos { get; }
        /// <summary>
        /// True if no error but warnings are present
        /// </summary>
        bool HasWarnings { get; }
        /// <summary>
        /// True if no errors
        /// </summary>
        bool IsValid { get; }
        /// <summary>
        /// Stores collection of properties with errors for conditional rules
        /// </summary>
        Dictionary<string, IValidationInfo> RelativesInfo { get; }
        /// <summary>
        /// Override error string
        /// </summary>
        /// <param name="text"></param>
        void SetError(string text);
        /// <summary>
        /// Overrides info string
        /// </summary>
        /// <param name="text"></param>
        void SetInfo(string text);
        /// <summary>
        /// Overrides warning string
        /// </summary>
        /// <param name="text"></param>
        void SetWarning(string text);
        /// <summary>
        /// Concatinates with other validation info
        /// </summary>
        /// <param name="validationResult"></param>
        void Add(IValidationInfo validationResult);
        /// <summary>
        /// Concatinates with collection of validation infos
        /// </summary>
        /// <param name="validationResults"></param>
        void AddRange(IEnumerable<IValidationInfo> validationResults);
    }
}
